package com.hdax.dm.controller;

import com.hdax.dm.dto.CommonResponse;
import com.hdax.dm.dto.DtoUtil;
import com.hdax.dm.service.SchedulerSeatService;
import com.hdax.dm.vo.GetScheduleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class SchedulerSeatController {

    @Autowired
    private SchedulerSeatService schedulerSeatService;

    /**
     * 查询剧场座位票价信息
     * @param params
     * @return
     */
    @PostMapping(path = "/seat/getSchedule")
    public CommonResponse<GetScheduleVo> getSchedule(@RequestBody Map<String,Long> params){
        Long scheduleId = params.get("scheduleId");
        Long cinemaId = params.get("cinemaId");
        return DtoUtil.returnSuccess("",schedulerSeatService.seatInfoList(scheduleId,cinemaId));
    }

    @PostMapping(path = "/seat/getSeatList")
    public CommonResponse<Map<String, List<String>>> seatList(@RequestBody Map<String,Long> params){
        Long id = params.get("scheduleId");
        return DtoUtil.returnSuccess("",schedulerSeatService.getSeatList(id));
    }

}
